"use strict";

const Controller = require("egg").Controller;

class HomeController extends Controller {
    async addtolist() {
        const { ctx, app } = this;
        const {

            region = "", //所属地区
                realname = "", //楼盘名称
                price = "", //均价
                realaddress = "", //楼盘地址
                salesaddress = "", //售楼处地址
                openingtime = "", //开盘时间
                deliverytime = "", //交房时间
                salestelephone = "", //售楼电话
                precertificate = "", //预售证号
                developers = "", //开发商
                mapcoordinates = "", //地图坐标
                redenvelopes = "", //购房红包
                preferentialreal = "", //优惠楼盘
                status = "",
                decoration = "",
                salesstatus = "",
                realtype = "",
                featurelabel = "",
                recommended = "",
                thumbnail = "",
                housevideo = "",
                realintroduction = "",
                buildingtype = "",
                yearsrights = "",
                areacovered = "",
                builtup = "",
                plotratio = "",
                rate = "",
                plannednumber = "",
                parkingspace = "",
                propertytype = "",
                company = "",
                propertyfee = "",
                img = "",
                mpsi = "",

        } = ctx.request.body;

        console.log(
            "ctx.request.body",
            propertyfee,
            img,
            mpsi,
            region,
        );




        await app.mysql.insert("addtolist", {
            region: region.toString(),
            realname,
            price,
            realaddress,
            salesaddress,
            openingtime,
            deliverytime,
            salestelephone,
            precertificate,
            developers,
            mapcoordinates,
            redenvelopes,
            preferentialreal,
            status,
            decoration,
            salesstatus,
            realtype,
            featurelabel,
            recommended,
            thumbnail: img,
            housevideo: mpsi,
            realintroduction,
            buildingtype: buildingtype.toString(),
            yearsrights: yearsrights.toString(),
            areacovered,
            builtup,
            plotratio,
            rate,
            plannednumber,
            parkingspace,
            propertytype,
            company,
            propertyfee,

        });


        ctx.body = {
            code: 1,
            msg: "添加数据",
            // data
        };
    }
}

module.exports = HomeController;

//    realction = "", realintroduction